Table of Contents
- Getting Started
- EO.Pdf
- Overview
- Installation and Deployment
- Using HTML to PDF
- Using PDF Creator
- Using PDF Creator
- Getting Started
- Advanced Formatting Techniques
- Interactive Features
- Low Level Content Objects
- Working with Existing PDF Files
- Using in Web Application
- Advanced Topics
- EO.Web
- EO.WebBrowser
- EO.Wpf
- Common Topics
- Reference
Introducing Styles |
All ACM content classes such as AcmText derive from AcmContent, which exposes Style property with which you can control the content styles such as size, position, border, color, font, etc. Styles in EO.Pdf work in a way very similar to standard Web CSS styles.
The following sample is based on the previous "Hello, World" sample but uses a different font:
using System; using System.Drawing; using EO.Pdf; using EO.Pdf.Acm; namespace EO.Pdf.Demo { public class Program { static void Main() { //Create an empty PDF document PdfDocument doc = new PdfDocument(); //Create an ACM Render AcmRender render = new AcmRender(doc); //Create an ACM text object AcmText text = new AcmText("Hello World!"); //Set the text font and color text.Style.FontName = "Verdana"; text.Style.FontSize = 20f; text.Style.ForegroundColor = Color.Blue; //Render the text object to the PDF render.Render(text); //Save the PDF file doc.Save("HelloWorld.pdf"); } } }
Styles offer much more than just font. For more details, see Style and stylesheet.